home *** CD-ROM | disk | FTP | other *** search
- Path: nova.nuc.umr.edu!not-for-mail
- From: sdrumm@nova.nuc.umr.edu (Scott Walter Drumm)
- Newsgroups: comp.lang.c++
- Subject: Numerical Class Ideas
- Date: 3 Apr 1996 16:29:29 -0600
- Organization: UMR Nuclear Engineering.
- Message-ID: <4juu49$l7u@nova.nuc.umr.edu>
- NNTP-Posting-Host: nova.nuc.umr.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
-
- I was wondering if any of you could give me some advice in constructing
- a class library for numerical analysis routines. I have all the
- necessary algorithms, but am not quite what the best way is to structure
- the class hierarchy.
-
- Currently I have a primeval base class containing an error-handler and
- other associated functions that are inherited by all other classes.
- From that point I can see three basic options:
-
- 1. Declare each routine as a new class descended from the primeval
- base class. Thus, there would be separate classes for Bisection,
- Newton-Raphson, Ridder's Method, etc. (using root-finding algorithms
- as an example). This results in a two-level inheritance tree, and
- is the most straightforward implementation but it doesn't take much
- advantage of C++'s capabilities. For this approach, the only real
- gain is in avoiding a global declaration of the error-handler.
-
- 2. Create intermediary classes off of the base class for each group
- of similar algorithms. Thus, there would be a Root_Find class
- from which the above algorithms would be descended from. This
- would allow me to group the initialization and output routines for
- each algorithm together; however, most of the routines are of the
- simple float f(..) variety, and don't have much in the way of
- initialization/output code, so I don't know how much I'd gain.
-
- 3. Forget a class implementation, code them all as separate functions
- and stuff them into a .c file. ;)
-
- I suppose the crux of the matter is this: Is it worth it to create
- categorical classes (which cannot be used by themselves) merely to force
- basically unrelated functions together in a multi-level class hierarchy?
-
- Brief examples, bits of wisdom, slaps upside the head, etc. would be
- appreciated. Thanx.
-
-
-
- /----------------------------\/--------------------------------------------\
- | | OS/2 v3.0 - Warp |
- | ------------------ | Isn't it time to expect more from |
- | sdrumm@albert.nuc.umr.edu | your operating system? |
- \----------------------------/\--------------------------------------------/
-
- GE(Nuclear) d? H-- s !g p?+ au+ a23 w+++ !v C++++ UB+ P? L 3 E-- N++ K-
- W--- M-- V-- po+ Y++ t++ 5++ !j R++ G''' tv b++ D++ B--- e-- -u h+ f !r n+ !y+
-
-
- -----BEGIN PGP PUBLIC KEY BLOCK-----
- Version: 2.6
-
- mQCNAy77IHoAAAEEALYk690QdoGgkqB7ocVmK3txmAns9e1G5N4Osm+G7sg+UGeq
- DZsmkG1tPcFrfYZJG5EnGhrLo7UnAktaajWCD8rwAjAiwNWLcMnpG/rRFXOwPSfR
- 0U5/ovqtX7P8pxn3Z8Z0yB+4l1J1QU4EOtE5oRE6zqV4wCI+mXvsBan6w9vZAAUR
- tCpTY290dCBXLiBEcnVtbSA8c2RydW1tQGFsYmVydC5udWMudW1yLmVkdT4=
- =g0jL
- -----END PGP PUBLIC KEY BLOCK-----
-
-